package br.com.caelum.vraptor.dao;
import javax.persistence.NoResultException;

import br.com.caelum.vraptor.entidades.Supervisor;

public class SupervisorDAO extends GenericJPADAO<Supervisor>{
	
	public SupervisorDAO(){
		this.persistentClass= Supervisor.class;
	}
	
	public Supervisor find(String email, String senha){
		try{
			Supervisor n = getEm().createQuery("select a from Aluno a where a.email like :email and a.senha = :senha", Supervisor.class)
		   .setParameter("email", email)
		   .setParameter("senha", senha)
		   .getSingleResult();
			return n;
		}
		catch(NoResultException e){
			return null;
		}
	}
}
